<!-- 人员系数统计 -->
<template>
  <div>
    <div class="searchbox">
      <el-form :inline="true" size="small" label-width="100px">
        <jt-easy-collapse :has-expand="true">
          <template slot="expand">
            <el-form-item label="任务单号">
              <el-input size="small" v-model="form.taskNo" placeholder="请输入任务单号"></el-input>
            </el-form-item>
            <el-form-item style="margin-left: 20px;">
              <el-button size="mini" type="primary" @click="deleteOrder()">删除</el-button>
            </el-form-item>
          </template>
        </jt-easy-collapse>
      </el-form>
    </div>
  </div>
</template>

<script>
import {
    qrcodedelList,
 postDeleteService
} from "service/task";
  import JtEasyCollapse from 'components/jt-easy-collapse/index';
  import chooseAcceptUidVal from 'dialog/report-center/acceptUid-button';
  import echarts from 'echarts';
  import DataInfo from 'dialog/report-center/statistics-of-coefficient-of-personal/data-infomation';
  export default {
    name: 'RemindingCenter',
    components: {
      'jt-easy-collapse': JtEasyCollapse,
      'acceptUid-button': chooseAcceptUidVal,
      'data-infomation': DataInfo
    },
    data() {
      return {
        date:"",
        fromDateEnd:"",
        toDateEnd:"",
        form: {
          taskNo: '',
          partName: '',
          partNumber: '',
          partGraphNumber: '',
          sampleStatusPhase: null,
          projectNo: '',
          batchNumber: '',
          materialNo: ''
        },
        id: "",
        isShowAdd:false,
         orderId: "", 
         currentPage: 1,
        pageNumber: 1,
        pageSize: 10,
        sort: '',
        order: '',
        testList: []
      }
    },
    mounted() {
    },
    methods: {
      deleteOrder(row) {
        if(this.form.taskNo == "" || this.form.taskNo==null || this.form.taskNo == " "){
          this.$message({
            type: 'error',
            message: '任务单号不能为空!'
          });
          return;
        }
          qrcodedelList({ ...this.form,
            pageNumber: this.pageNumber,
            pageSize: this.pageSize,
            sort: this.sort,
            order: this.order
          })
          .then(res => {
            if(res.data.result.content.length==0){
              this.$message({
                  message:"任务单号已删除", 
                  type: 'error'
              })
              return;
            }
            this.$confirm('是否删除此条数据?', '提示', {
            // confirmButtonText: '确定',
            // cancelButtonText: '取消',
            type: 'warning'
            }).then(() => {
                postDeleteService(res.data.result.content[0].id)
                    .then(res1 => {
                    if (res1.data.success) {
                        this.$message({
                    message: res1.data.message,
                    type: 'success',
                    duration: 1000
                    });
                    } else {
                        this.$alert(res1.data.message, '提示', {
                        type: 'error'
                        })
                    }
                    })
                }).catch(() => {});
            })
         }
     }
  }
</script>
